package com.hsz.control.validation.annotation;

import com.hsz.base.sensitivewords.EngineType;
import com.hsz.base.sensitivewords.core.engine.IBaseSensitiveWordEngine;
import com.hsz.base.standard.constant.ContentType;
import com.hsz.control.validation.constraint.SensitiveValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Sensitive
 *
 * @description: 敏感字校验注解
 * @author: cyj
 * @date 2020 -12-01 11:04:58
 */
@Target({FIELD})
@Retention(RUNTIME)
@Constraint(validatedBy = SensitiveValidator.class)
public @interface Sensitive {

    /**
     * Message string
     *
     * @return the string
     */
    String message() default "base.validation.annotation.sensitive";

    /**
     * Content type content type  标记敏感字校验字段类型
     *
     * @return the content type
     */
    ContentType contentType();

    /**
     * Engine type engine type 敏感字校验引擎模式
     *
     * @return the engine type
     */
    EngineType engineType() default EngineType.DFA;

    /**
     * Engine rule base sensitive word engine . rule 校验规则
     *
     * @return the base sensitive word engine . rule
     */
    IBaseSensitiveWordEngine.Rule engineRule() default IBaseSensitiveWordEngine.Rule.ALL_SEARCH;

    /**
     * Groups class [ ]
     *
     * @return the class [ ]
     */
    Class<?>[] groups() default {};

    /**
     * Payload class [ ]
     *
     * @return the class [ ]
     */
    Class<? extends Payload>[] payload() default {};

}
